package com.example.server.controller;

import com.example.server.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@CrossOrigin
@Controller
@RequestMapping("/users")
public class UserController {


    private final UserService userService;
    public UserController(UserService userService) {
        this.userService  = userService;
    }

    @RequestMapping("/login")
    @ResponseBody
    public String login(String username, String password){
        return userService.login(username, password);
    }
}
